﻿package mortal.game.view.ActionIconPublic
{
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.player.info.*;
    import mortal.game.view.ActionIconPublic.wechatReward.*;
    import mortal.game.view.systemSetting.*;
    import mortal.mvc.core.*;

    public class ActionIconPublicController extends Controller
    {

        public function ActionIconPublicController()
        {
            return;
        }// end function

        override protected function initServer() : void
        {
            NetDispatcher.addCmdListener(ServerCommand.ActivationTakeBackInfo, this.onActivationTakeBack);
            NetDispatcher.addCmdListener(ServerCommand.SystemClientSettingGot, this.checkIsWechatShow);
            Cache.instance.role.roleEntityInfo.addEventListener(EntityInfoEventName.UpdateLevel, this.checkIsWechatShow);
            return;
        }// end function

        private function onActivationTakeBack(param1:Object) : void
        {
            var _loc_2:* = param1 as int;
            if (_loc_2 == 29)
            {
                ClientSetting.local.setIsDone(true, IsDoneType.IsGetWechatReward);
                this.checkIsWechatShow();
            }
            return;
        }// end function

        private function checkIsWechatShow(param1:Object = null) : void
        {
            var _loc_2:* = Cache.instance.role.entityInfo.level;
            if (ParamsConst.instance.isYYFormalPlan && _loc_2 >= GameDefConfig.instance.getSystemOpenLevel(95) && _loc_2 <= GameDefConfig.instance.getSystemCloseLevel(95) && !ClientSetting.local.getIsDone(IsDoneType.IsGetWechatReward))
            {
                WechatRewardIcon.instance.show();
            }
            else
            {
                if (WechatRewardIcon.isViewShow)
                {
                    WechatRewardIcon.instance.hide();
                }
                if (WechatRewardModule.isViewShow)
                {
                    WechatRewardModule.instance.hide();
                }
            }
            return;
        }// end function

    }
}
